package com.geng.filter.filterImpl;

import com.geng.dto.MyRequest;
import com.geng.dto.MyResponse;
import com.geng.filter.Filter;
import com.geng.filter.FilterChain;

/**
 * filter1
 */
public class FistFilter implements Filter {
    @Override
    public void doFilter(MyRequest request, MyResponse response, FilterChain filterChain) {
        /**
         * 尝试在filter链做手脚,完成
         */
        if(request.getInvokedMethodName().equals("sayHello"))
           request.setInvokedMethodName("sayHelloAnother");
        System.out.println("first filter before");
        filterChain.doFilter(request,response);
        System.out.println("first filter after");
    }

    @Override
    public int getPriority() {
        return 0;
    }
}
